import 'package:chi_med_det_flutter/archive.dart';
import 'package:chi_med_det_flutter/home.dart';
import 'package:chi_med_det_flutter/personal.dart';
import 'package:flutter/material.dart';

class MainPage extends StatefulWidget {
  const MainPage({super.key});


  @override
  State<StatefulWidget> createState() => _MainPageState();
}

class _MainPageState extends State<MainPage> {
  int _selectedIndex = 0;

  final _mainList = <Widget>[Home(), Archive(), Personal()];

  void _onItemTapped(int index) {
    setState(() {
      _selectedIndex = index;
    });
  }

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(title: Text("中医体质检测系统")),
      body: Center(child: _mainList[_selectedIndex]),
      bottomNavigationBar: BottomNavigationBar(
        items: <BottomNavigationBarItem>[
          BottomNavigationBarItem(icon: Icon(Icons.home), label: '首页'),
          BottomNavigationBarItem(icon: Icon(Icons.archive), label: '健康档案'),
          BottomNavigationBarItem(icon: Icon(Icons.person), label: '个人中心'),
        ],
        fixedColor: Colors.purple,
        onTap: _onItemTapped,
        currentIndex: _selectedIndex,
      ),
    );
  }
}
